<?php
include_once "util.php";
$start = 12010000;
$end = 48226850;
$questions = [];
for ($current = $start; $current <= $end; $current++) {
    $url = "http://ask.39.net/question/{$current}.html";
    $content = getHTML($url) ?: getHTML($url, false);
    preg_match("/病情描述及疑问：<\/strong>(.*)<\/p>/siU", $content, $match);
    if (isset($match[1]) && $match[1]) $questions[] = $match[1];
    echo "Finished: {$current}/{$end}\n";
}
dumpVariableToFile($questions, "result/questions.php", "questions");
$fp = fopen("result/questions.txt", "w");
foreach ($questions as $question) {
    fwrite($fp, "{$question}\n");
}
fclose($fp);